/*
 * @Author: 一路向阳 tt_sunzhenfeng@163.com
 * @Date: 2024-05-25 12:01:24
 * @LastEditors: 一路向阳 tt_sunzhenfeng@163.com
 * @LastEditTime: 2024-05-25 14:49:10
 * @FilePath: \vue3_nuxt_demo\apis\auth.ts
 * @Description: 用户管理接口
 */

import { useHttpFetch, type IFetchOptions } from '@/composables/useHttpFetch';

// 登录
interface ILogin extends IFetchOptions {
  phone: string;
  password: string;
}
export const userLogin = (opt: ILogin) => {
  return useHttpFetch('/api/auth/login', {
    ...opt,
    method: 'POST',
    key: 'userLogin'
  });
}

// 注册
interface IRegister extends IFetchOptions {
  nick: string;
  phone: string;
  password: string;
}
export const userRegister = (opt: IRegister) => {
  return useHttpFetch('/api/auth/register', {
    ...opt,
    method: 'POST',
    key: 'userRegister'
  });
}